package com.jy.oms.framework.asyn.task.model;

import com.jy.oms.framework.asyn.task.constants.TaskStateEnum;

import java.util.StringJoiner;

/**
 * 任务
 *
 * @author liuquan
 */
public class TaskDto {

    /**
     * 任务编码
     */
    private String taskCode;

    /**
     * 任务管理单据
     */
    private String billCode;

    /**
     * 任务运行参数
     */
    private Object param;

    /**
     * 任务延迟执行时间
     */
    private Long delayedSeconds;

    /**
     * 任务创建者
     */
    private String creator;

    /**
     * 任务状态
     */
    private TaskStateEnum taskState = TaskStateEnum.UNDO;

    public static TaskDto create() {
        return new TaskDto();
    }

    public String getTaskCode() {
        return taskCode;
    }

    public TaskDto setTaskCode(String taskCode) {
        this.taskCode = taskCode;
        return this;
    }

    public String getBillCode() {
        return billCode;
    }

    public TaskDto setBillCode(String billCode) {
        this.billCode = billCode;
        return this;
    }

    public Object getParam() {
        return param;
    }

    public TaskDto setParam(Object param) {
        this.param = param;
        return this;
    }

    public Long getDelayedSeconds() {
        return delayedSeconds;
    }

    public TaskDto setDelayedSeconds(Long delayedSeconds) {
        this.delayedSeconds = delayedSeconds;
        return this;
    }

    public String getCreator() {
        return creator;
    }

    public TaskDto setCreator(String creator) {
        this.creator = creator;
        return this;
    }

    public TaskStateEnum getTaskState() {
        return taskState;
    }

    public TaskDto setTaskState(TaskStateEnum taskState) {
        this.taskState = taskState;
        return this;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", TaskDto.class.getSimpleName() + "[", "]")
                .add("taskCode='" + taskCode + "'")
                .add("billCode='" + billCode + "'")
                .add("param=" + param)
                .add("delayedSeconds=" + delayedSeconds)
                .add("creator='" + creator + "'")
                .add("taskState=" + taskState)
                .toString();
    }
}
